/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package webservice.notafiscaleletronica.cacerts;

import javax.net.ssl.*;
import java.security.cert.X509Certificate;

/**
 *
 * @author Icaro
 */
public class SavingTrustManager implements X509TrustManager {

    private final X509TrustManager tm;
    X509Certificate[] chain;

    SavingTrustManager(X509TrustManager tm) {
        this.tm = tm;
    }

    @Override
    public void checkClientTrusted(java.security.cert.X509Certificate[] xcs, String string) throws java.security.cert.CertificateException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void checkServerTrusted(X509Certificate[] chain, String authType) throws java.security.cert.CertificateException {
        this.chain = chain;
        this.tm.checkServerTrusted(chain, authType);
    }

    @Override
    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
        return new X509Certificate[0];
    }

}
